"""
A module listing all of the default combat actions.
"""

from actions import Action

class BoatCombatAction(Action):
    id = "combat.boat.attack"
    name = "Boat Combat"
    description = "Attack with a boat's cannon."
    thingsNeeded = {'boat': 1, 'pirate': 1, 'target': 1, 'weapon': 1}
    thingsMax = {'boat': 1, 'pirate': 2, 'target': 1, 'weapon': 1}
    turnsNeeded = 1
    turnsMax = -1
    
    def canStop(self):
        if len(self.actors['pirate']) == 2:
            return True
        elif len(self.actors['pirate']) == 1:
            return self.turnsActing % 2 == 0
    
    def act(self):
        boat = self.actors['boat'][0]
        target = self.actors['target'][0]
        weapon = self.actors['weapon'][0]
        return boat.attack(target, weapon)


class StandardCombatAction(Action):
    id = "combat.standard.attack"
    name = "Standard Coombat"
    description = "Something attacks something else with a happen it has"
    thingsNeeded = {'attacker': 1, 'target': 1, 'weapon': 1}
    thingsMax = {'attacker': 1, 'target': 1, 'weapon': 1}
    turnsNeeded = 1
    turnsMax = -1
    
    def act(self):
        attacker = self.actors['attacker'][0]
        target = self.actors['target'][0]
        weapon = self.actors['weapon'][0]
        return attacker.attack(target, weapon)